﻿@model List<Jb.Web.ViewModels.CompanyViewModel>
@using Jb.Web.Utility;
@using Jb.Common.Extensions;

@{
    String pageTitle = "Company List";
    ViewBag.Title = Html.GetPageTitle(pageTitle);
}
<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>Featured companies in @ConfigReader.SiteName</div>
</div>

<div class="jb-page-content">
    @if (Model == null || Model.Count == 0)
    {
        @Html.InfoMessageBox("Sorry! could not find any active company.", "No Record")
    }
    else {        
        for (int i = 0; i < Model.Count; i++)
        {
            Jb.Web.ViewModels.CompanyViewModel company = Model[i];
            String _CompanyUrl = Url.Content(String.Format("~/{0}", company.Url));
            if ((i % 3) == 0)
            {
                @:<div class="row-fluid">
            }
            <div class="span4">
                <div class="row-fluid">
                    <div class="span5">
                        <a href="@_CompanyUrl"><img src="@ImageManager.GetCompanyLogoUrl(company.LogoFile, company.ID)" alt="@company.Name" title="@company.Name" /></a>
                    </div>
                    <div class="span7">
                        <div><a href="@_CompanyUrl">@company.Name</a></div>
                        <div>@(company.Address.StreetAddress)</div>
                        @if (!company.Address.Email.IsNullOrEmpty() && String.Compare(company.Address.Email, AppConstants.ValueOf.UNKNOWN, true) != 0)
                        {
                        <div>@(company.Address.Email)</div>
                        }                        
                        @if (!company.Address.WebSite.IsNullOrEmpty())
                        {
                        <div>Web Site: <a href="@(WebUtil.GetCompleteUrl(company.Address.WebSite))">@(WebUtil.GetCompleteUrl(company.Address.WebSite))</a></div>
                        }
                    </div>
                </div>
            </div>
            ///End Tag Checking
            if (i == (Model.Count - 1) || ((i + 1) % 3) == 0)
            {
                @:</div>
                <div class="clearfix"></div>
            }
        }
    }
</div>